<?php
	$d = $_GET["path"];
	$handle = opendir($d);
	$files = array();
	$directories = array();
	$i = -1;
	$j = -1;
	while ($file = readdir($handle))
	{
		if (($file != ".") && ($file != ".."))	
		{
			if (strpos($file,".") > 0)
			{
				$i = $i + 1;
				$files[$i] = $file;
			}
			else
			{
				$j = $j + 1;
				$directories[$j] = $file;
			};
		};
	};
	closedir($handle);
	sort($files);
	sort($directories);
	if ($j >= 0)
	{
		for ( $j = 0 ; $j < count($directories) ; $j ++ )
		{
			echo $directories[$j].";";
		}
	}
	echo "#";
	if ($i >= 0)
	{
		for ( $i = 0 ; $i < count($files) ; $i ++ )
		{
			echo $files[$i].";";
		}
	}
?>
